package org.jacp.demo.services;

import java.util.List;

import org.jacp.demo.dao.EmployeeDAO;
import org.jacp.demo.entities.Employee;

public class EmployeeServiceImpl implements EmployeeService{
    
    private EmployeeService dao;

    @Override
    public Employee save(Employee emp) {
	return this.getDao().save(emp);
    }

    @Override
    public void delete(Employee emp) {
	this.getDao().delete(emp);
    }

    @Override
    public Employee update(Employee emp) {
	return this.getDao().update(emp);
    }

    @Override
    public List<Employee> findAll() {
	return this.getDao().findAll();
    }

    @Override
    public List<Employee> findByEmployeeNumber(String empno) {
	return this.getDao().findByEmployeeNumber(empno);
    }

    @Override
    public List<Employee> findByEmployeeLastName(String lastName) {
	return this.getDao().findByEmployeeLastName(lastName);
    }

    @Override
    public List<Employee> findByAddressStreetName(String streetName) {
	return this.getDao().findByAddressStreetName(streetName);
    }

    @Override
    public Employee findById(long id) {
	return this.getDao().findById(id);
    }

    @Override
    public List<Employee> findEmployeeWithSalaryOver(double sal) {
	return this.getDao().findEmployeeWithSalaryOver(sal);
    }

    @Override
    public List<Employee> findEmployeeWithCommissionOver(double comm) {
	return this.getDao().findEmployeeWithCommissionOver(comm);
    }

    @Override
    public List<Employee> findByEmployeeName(String name) {
	for(int i=0; i<=1000;i++) {

	    System.out.println("hhhh");
    }
	return this.getDao().findByEmployeeName(name);
    }

    public EmployeeService getDao() {
        return dao;
    }

    public void setDao(EmployeeService dao) {
        this.dao = dao;
    }

}
